Added format specifier for yearqtr#7713
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7713 +/- ##
=======================================
Coverage 99.04% 99.04%
=======================================
Files 87 87
Lines 17123 17058 -65
=======================================
- Hits 16959 16895 -64
+ Misses 164 163 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Solid first approach. Keep in mind that we strive for efficiency with |
ben-schwen
left a comment
There was a problem hiding this comment.
We are close to being mergeable.
However, to fully close the issue you would also need to mirror the approach for yearmon with a similar encoding d="2019-01-01" as yearmon(d, "character") as "2019M1"
| \item{units}{one of the units listed for truncating. May be abbreviated.} | ||
| \item{ms}{ For \code{as.ITime} methods, what should be done with sub-second fractions of input? Valid values are \code{'truncate'} (floor), \code{'nearest'} (round), and \code{'ceil'} (ceiling). See Details. } | ||
| \item{format}{format is either \code{"numeric"} (default) or \code{"character"}. \code{"character"} formats the result as \code{"2025Q4"}.} | ||
| \item{format}{format is either \code{"numeric"} (default) or \code{"character"}. \code{"character"} formats the result as \code{"2025M4"} for \code{yearmon} and \code{"2025Q4"} for \code{yearqtr}.} |
There was a problem hiding this comment.
2025M04
Otherwise sorting character will be not as user expects, unless we go for format=factor where we can define order
There was a problem hiding this comment.
Maybe
ans[ok] = sprintf("%dM%02d", as.integer(yr), as.integer(mon))
so if a user sorts on the last two characters it's always integers?
There was a problem hiding this comment.
Maybe
ans[ok] = sprintf("%dM%02d", as.integer(yr), as.integer(mon))so if a user sorts on the last two characters it's always integers?
Yeah, thats exactly what I would do!
ben-schwen
left a comment
There was a problem hiding this comment.
Last minor tweaks about coding style and docs.
Basically LGTM, TY!
|
Cool, thank you!
…On Mon, Apr 27, 2026 at 8:30 AM Benjamin Schwendinger < ***@***.***> wrote:
Merged #7713 <#7713> into
master.
—
Reply to this email directly, view it on GitHub
<#7713 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A27VLG5T2NVFMYZKBELD3UD4X54K7AVCNFSM6AAAAACYAISMYSVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMRUHEYTEMZYGIYTMNY>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Closes #7694